$(document).ready(function(){

    var clickSum = 1;
    var accountClickSum = 1;

    $(".loginMenu").click(function(){
        if(clickSum){
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(180deg)'
            });
            $(".dropdown-menu").slideDown("fast");
            clickSum--;
        }else{
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            $(".dropdown-menu").slideUp("fast");
            clickSum++;
        }
    });


    $(document).click(function(){
        if(!clickSum){
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            $(".dropdown-menu").slideUp("fast");
            clickSum++;
        }
    });

    $(".account").click(function(){
        if(accountClickSum){
            $(".account .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(180deg)'
            });
            accountClickSum--;
        }else{
            $(".account .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            accountClickSum++;
        }

        $(".account-dropdown").slideToggle("fast");
    });

    var currentDir = 0;
    
    $(".record-send").click(function () {
        if(currentDir){
            $(".record-send").css("background-color","#3399cc");
            $(".record-receive").css("background-color","#85b1c7");
            $(".receive-container").animate({width:'toggle'},300);
            $(".send-container").animate({width:'toggle'},300);
            currentDir--;
        }
    });

    $(".record-receive").click(function () {
        if(!currentDir){
            $(".record-send").css("background-color","#85b1c7");
            $(".record-receive").css("background-color","#3399cc");
            $(".send-container").animate({width:'toggle'},300);
            $(".receive-container").animate({width:'toggle'},300);
            currentDir++;
        }
    })

});